from PIL import Image


def main():
    image = Image.open('./zk-watcher.png')
    image.format, image.size, image.mode
    ('JPEG', (500, 750), 'RGB')
    image.show()


"""
剪裁图像
"""


def chaijian():
    image = Image.open('./zk-watcher.png')
    rect = 80, 20, 310, 360
    image.crop(rect).show()


"""
生成缩略图
"""


def suolvetu():
    image = Image.open('./zk-watcher.png')
    size = 128, 128
    image.thumbnail(size)
    image.show()


"""
缩放和黏贴图像
"""


def crop():
    image1 = Image.open('./zk-watcher.png')
    image2 = Image.open('./zk-watcher2.png')
    rect = 80, 20, 310, 360
    guido_head = image2.crop(rect)
    width, height = guido_head.size
    image1.paste(guido_head.resize((int(width / 1.5), int(height / 1.5))), (172, 40))


"""
旋转和翻转
"""


def rotate():
    image = Image.open('./zk-watcher.png')
    image.rotate(180).show()
    image.transpose(Image.FLIP_LEFT_RIGHT).show()


if __name__ == '__main__':
    # main()
    # chaijian()
    # suolvetu()
    # crop()
    rotate()
